#include <stdint.h>
#include <stdbool.h>
#include "utils/ustdlib.h"
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/pin_map.h"
#include "driverlib/debug.h"
#include "driverlib/hibernate.h"
#include "driverlib/gpio.h"

/*



Current Result Measurement:

22.7mA for on.
0.0063 mA. or 6.3uA. in RTC
0.0067 mA. or 6.7uA. in non-RTC   



*/

int main(void)
{
	SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); /// 40MHZ


	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); /// Enables POrtF
	GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); //// Sets PortF pin1,2,3 to output
	GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0x08); //// Write green to pin1,2,3

	SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE); //// Enables the system for hibernation
	HibernateEnableExpClk(SysCtlClockGet()); //// What clock hibernation uses
	HibernateGPIORetentionEnable(); ///// Keeps the GPIO information to remain the same, in hibernation and out
	SysCtlDelay(64000000); /////// Wait a few seconds
	HibernateWakeSet(HIBERNATE_WAKE_PIN); //////// Set the wake condition to the wake pin
	GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_3, 0x00); /// Turn off the LED

	HibernateRequest(); /////// Requests for the system to be put into hibernate
	while(1)
	{
	}
}
